﻿#define _CRT_SECURE_NO_WARNINGS 1

//编程初学者入门训练第十三题
//BC15 按照格式输入并交换输出
//https://www.nowcoder.com/practice/95eb723a3e854376a7eb6d116cc7d875?tpId=107&tqId=33296&rp=1&ru=/exam/oj/ta&qru=/exam/oj/ta&sourceUrl=%2Fexam%2Foj%2Fta%3Fpage%3D1%26pageSize%3D50%26search%3D%26tpId%3D107%26type%3D107&difficulty=undefined&judgeStatus=undefined&tags=&title=

//第一种，“假”交换
#include <stdio.h>

int main() {
    int a = 0;
    int b = 0;

    scanf("a=%d,b=%d", &a, &b);

    printf("a=%d,b=%d", b, a);

    return 0;
}

//第二种，真交换
#include <stdio.h>

int main() {
    int a = 0;
    int b = 0;
    int c = 0;
    scanf("a=%d,b=%d", &a, &b);

    c = a;
    a = b;
    b = c;

    printf("a=%d,b=%d", a, b);

    return 0;
}

//第三种,不依靠变量交换。
#include <stdio.h>

int main() {
    int a = 0;
    int b = 0;
    scanf("a=%d,b=%d", &a, &b);

    a = a ^ b;
    b = a ^ b;
    a = a ^ b;

    printf("a=%d,b=%d", a, b);
    return 0;
}